char *strsub(const char *s, const char *search, const char *replace);
char *gstrsub(const char *s, const char *search, const char *replace);
+char *xstrrstr(const char *s1, const char *s2);
void rtrim(char *s);
signed int get_tz_offset(void);
time_t mkgmtime(struct tm *t);
wpt_tmp->description = xstrappend(wpt_tmp->description,args);
if (nuke_placer) {
- char *s = strstr(wpt_tmp->description, " by ");
+ char *s = xstrrstr(wpt_tmp->description, " by ");
if (s) {
*s = '\0';
}
return o;
}
+/*
+ * Like strstr, but starts from back of string.
+ */
+char *
+xstrrstr(const char *s1, const char *s2)
+{
+ char *r = NULL, *next = NULL;
+
+ while (next = strstr(s1, s2)) {
+ r = next;
+ s1 = next + 1;
+ }
+ return r;
+}
+
+
char *
rot13( const char *s )
{